1. Field of the Invention
The present invention relates to a data management apparatus and method for use in a flash memory, and more particularly, to a data management apparatus and method for use in a flash memory, which can deal with defective blocks in each flash memory in a system using at least one flash memory by taking into consideration how the system processes data stored in each flash memory.
2. Description of the Related Art
In general, home appliances, communications devices, and embedded systems, such as set-top boxes, use non-volatile memories as storage devices for storing and processing data.
Flash memories are one type of non-volatile memory, in which data can be electrically erased and overwritten. Flash memories are suitable for portable devices because they consume less power than magnetic disc memory-based storage mediums, are as accessible as hard discs, and are compact-sized.
Due to the hardware characteristics of flash memories, data recorded on a flash memory should be erased before data is overwritten on the flash memory.
A unit in which data is recorded on a flash memory may differ from a unit in which data is erased from the flash memory, which may result in deterioration of the performance of the flash memory.
In order to prevent the performance of the flash memory from deteriorating for this reason, logical addresses and physical addresses have been suggested. Logical addresses are virtual addresses specified by a user when executing a data operation on the flash memory with the use of a program. By comparison, physical addresses are actual addresses referenced when executing the data operation on the flash memory.
Flash memory is generally classified into either a small block flash memory or a large block flash memory. In a small block flash memory, a logical operation unit is equal to a physical operation unit, whereas in a large block flash memory, a logical operation unit is smaller than a physical operation unit.
In other words, supposing that the logical operation unit and physical operation unit of the flash memory are respectively referred to as a sector and a page, a sector and a page of the small block flash memory are identical, but a page of the large block flash memory is a predetermined number of times larger than a sector of the large block flash memory.
Data can be erased from a flash memory only a limited number of times. If data is erased from some of a plurality of blocks of the flash memory more than a maximum number of times that data can be erased from the flash memory, or if some of the blocks of the flash memory, from which data is erased almost as many times as the maximum number, are fragile for some reason, the corresponding blocks may become defective.
Defective blocks of the flash memory are categorized into initial defective blocks, which are defective blocks detected before the flash memory is shipped out of the factory, or run-time defective blocks, which are defective blocks generated by a user during executing a data operation on the flash memory.
All of the blocks of the flash memory may become defective, and defective blocks of the flash memory considerably affect the performance of the flash memory. Thus, various methods to efficiently deal with the defective blocks of the flash memory have been developed.
FIG. 1 is a schematic diagram illustrating the structure of a typical flash memory. Referring to FIG. 1, the typical flash memory includes a defective block management area 10, in which defective blocks of the typical flash memory are dealt with, and a data area 20, in which data computations are executed.
Specifically, the defective block management area 10 includes a defective block information area 11, which includes mapping information on the defective blocks of the typical flash memory, and a spare area 12, which provides substitute blocks that respectively replace the defective blocks of the typical flash memory.
Here, the mapping information on the defective blocks of the typical flash memory is realized as a mapping table that respectively maps the defective blocks of the typical flash memory with the substitute blocks in the spare area 12.
A conventional data management method using the defective block management area 10 will now be described. As shown in FIG. 2, in operation S11, it is determined whether there is an indication that a predetermined or current block of the typical flash memory is an initial defective block.
In operation S12, it is determined whether the predetermined block is an initial defective block based on the determination results obtained in operation S 11.
In operation S13, if the predetermined block is an initial defective block, the predetermined block of the flash memory is replaced with a normal block, specifically, a substitute block in the spare area 12, by referencing the mapping table.
Accordingly, a data operation, which is supposed to be performed on the predetermined block, can be performed on the substitute block that replaces the predetermined block.
In operation S14, it is determined if all blocks in the flash memory are subjected to defective block determination. If the predetermined block is not the last one, the iteration is initiated in operation S15 so that operations S11 through S14 can be performed on a block subsequent to the predetermined block.
If a defect occurs while performing the data operation on a block of the flash memory that has already been determined non-defective through operations S11 through S14, the corresponding block is determined to be a run-time defective block.
A conventional data management method for dealing with run-time defective blocks of a typical flash memory is illustrated in FIG. 3. Referring to FIG. 3, in operation S21, a data operation is performed on a predetermined or current block. In operation S22, it is determined whether the data operation has been successfully performed on the predetermined block.
Specifically, referring to FIG. 4A, the data operation is performed on a block 21 of a flash memory, and then it is determined whether the data operation has been successfully performed on the block 21 of the flash memory.
If the data operation is determined unsuccessful, then in operation S23 the predetermined block is determined defective and then registered with the mapping table.
In operation S24, the predetermined block is mapped with a substitute block in the spare area 12. In operation S25, a data operation, which is supposed to be performed on the predetermined block, is performed on the substitute block.
Specifically, referring to FIG. 4B, data stored in the block 21 in the data area 20 is transferred to a block 12a in the spare area 12.
Then, a data operation, which is supposed to be performed on the block 21 in the data area 20, is performed on the block 12a in the spare area 12 by referencing the mapping table specifying that the block 21 in the data area 20 is replaced with the block 12a in the spare area 12.
For example, if a defect occurs while writing data on the block 21 in the data area 20, part of the data that has been written on the block 21 is transferred from the block 21 to the block 12a in the spare area 12.
In addition, when a data operation is again performed on the block 21, the rest of the data is written on the block 12a in the spare area 12 by referencing the mapping table.
Thereafter, in operation S26, it is determined whether the data operation is complete. Unless the data operation is complete, operations S21 through S25 are repeatedly performed.
However, the above conventional data management methods of a flash memory can only be applied to a single flash memory and thus are not suitable for a system using plural flash memory.